using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

using ILRuntime.CLR.TypeSystem;
using ILRuntime.CLR.Method;
using ILRuntime.Runtime.Enviorment;
using ILRuntime.Runtime.Intepreter;
using ILRuntime.Runtime.Stack;
using ILRuntime.Reflection;
using ILRuntime.CLR.Utils;
using System.Linq;

namespace ILRuntime.Runtime.Generated
{
    unsafe class SevenZip_CoderPropID_Binding
    {
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            FieldInfo field;
            Type[] args;
            Type type = typeof(SevenZip.CoderPropID);

            field = type.GetField("DefaultProp", flag);
            app.RegisterCLRFieldGetter(field, get_DefaultProp_0);
            app.RegisterCLRFieldBinding(field, CopyToStack_DefaultProp_0, null);
            field = type.GetField("DictionarySize", flag);
            app.RegisterCLRFieldGetter(field, get_DictionarySize_1);
            app.RegisterCLRFieldBinding(field, CopyToStack_DictionarySize_1, null);
            field = type.GetField("UsedMemorySize", flag);
            app.RegisterCLRFieldGetter(field, get_UsedMemorySize_2);
            app.RegisterCLRFieldBinding(field, CopyToStack_UsedMemorySize_2, null);
            field = type.GetField("Order", flag);
            app.RegisterCLRFieldGetter(field, get_Order_3);
            app.RegisterCLRFieldBinding(field, CopyToStack_Order_3, null);
            field = type.GetField("BlockSize", flag);
            app.RegisterCLRFieldGetter(field, get_BlockSize_4);
            app.RegisterCLRFieldBinding(field, CopyToStack_BlockSize_4, null);
            field = type.GetField("PosStateBits", flag);
            app.RegisterCLRFieldGetter(field, get_PosStateBits_5);
            app.RegisterCLRFieldBinding(field, CopyToStack_PosStateBits_5, null);
            field = type.GetField("LitContextBits", flag);
            app.RegisterCLRFieldGetter(field, get_LitContextBits_6);
            app.RegisterCLRFieldBinding(field, CopyToStack_LitContextBits_6, null);
            field = type.GetField("LitPosBits", flag);
            app.RegisterCLRFieldGetter(field, get_LitPosBits_7);
            app.RegisterCLRFieldBinding(field, CopyToStack_LitPosBits_7, null);
            field = type.GetField("NumFastBytes", flag);
            app.RegisterCLRFieldGetter(field, get_NumFastBytes_8);
            app.RegisterCLRFieldBinding(field, CopyToStack_NumFastBytes_8, null);
            field = type.GetField("MatchFinder", flag);
            app.RegisterCLRFieldGetter(field, get_MatchFinder_9);
            app.RegisterCLRFieldBinding(field, CopyToStack_MatchFinder_9, null);
            field = type.GetField("MatchFinderCycles", flag);
            app.RegisterCLRFieldGetter(field, get_MatchFinderCycles_10);
            app.RegisterCLRFieldBinding(field, CopyToStack_MatchFinderCycles_10, null);
            field = type.GetField("NumPasses", flag);
            app.RegisterCLRFieldGetter(field, get_NumPasses_11);
            app.RegisterCLRFieldBinding(field, CopyToStack_NumPasses_11, null);
            field = type.GetField("Algorithm", flag);
            app.RegisterCLRFieldGetter(field, get_Algorithm_12);
            app.RegisterCLRFieldBinding(field, CopyToStack_Algorithm_12, null);
            field = type.GetField("NumThreads", flag);
            app.RegisterCLRFieldGetter(field, get_NumThreads_13);
            app.RegisterCLRFieldBinding(field, CopyToStack_NumThreads_13, null);
            field = type.GetField("EndMarker", flag);
            app.RegisterCLRFieldGetter(field, get_EndMarker_14);
            app.RegisterCLRFieldBinding(field, CopyToStack_EndMarker_14, null);


            app.RegisterCLRCreateDefaultInstance(type, () => new SevenZip.CoderPropID());
            app.RegisterCLRCreateArrayInstance(type, s => new SevenZip.CoderPropID[s]);


        }

        static void WriteBackInstance(ILRuntime.Runtime.Enviorment.AppDomain __domain, StackObject* ptr_of_this_method, IList<object> __mStack, ref SevenZip.CoderPropID instance_of_this_method)
        {
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            switch(ptr_of_this_method->ObjectType)
            {
                case ObjectTypes.Object:
                    {
                        __mStack[ptr_of_this_method->Value] = instance_of_this_method;
                    }
                    break;
                case ObjectTypes.FieldReference:
                    {
                        var ___obj = __mStack[ptr_of_this_method->Value];
                        if(___obj is ILTypeInstance)
                        {
                            ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = instance_of_this_method;
                        }
                        else
                        {
                            var t = __domain.GetType(___obj.GetType()) as CLRType;
                            t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, instance_of_this_method);
                        }
                    }
                    break;
                case ObjectTypes.StaticFieldReference:
                    {
                        var t = __domain.GetType(ptr_of_this_method->Value);
                        if(t is ILType)
                        {
                            ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = instance_of_this_method;
                        }
                        else
                        {
                            ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, instance_of_this_method);
                        }
                    }
                    break;
                 case ObjectTypes.ArrayReference:
                    {
                        var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as SevenZip.CoderPropID[];
                        instance_of_arrayReference[ptr_of_this_method->ValueLow] = instance_of_this_method;
                    }
                    break;
            }
        }


        static object get_DefaultProp_0(ref object o)
        {
            return SevenZip.CoderPropID.DefaultProp;
        }

        static StackObject* CopyToStack_DefaultProp_0(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = SevenZip.CoderPropID.DefaultProp;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static object get_DictionarySize_1(ref object o)
        {
            return SevenZip.CoderPropID.DictionarySize;
        }

        static StackObject* CopyToStack_DictionarySize_1(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = SevenZip.CoderPropID.DictionarySize;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static object get_UsedMemorySize_2(ref object o)
        {
            return SevenZip.CoderPropID.UsedMemorySize;
        }

        static StackObject* CopyToStack_UsedMemorySize_2(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = SevenZip.CoderPropID.UsedMemorySize;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static object get_Order_3(ref object o)
        {
            return SevenZip.CoderPropID.Order;
        }

        static StackObject* CopyToStack_Order_3(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = SevenZip.CoderPropID.Order;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static object get_BlockSize_4(ref object o)
        {
            return SevenZip.CoderPropID.BlockSize;
        }

        static StackObject* CopyToStack_BlockSize_4(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = SevenZip.CoderPropID.BlockSize;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static object get_PosStateBits_5(ref object o)
        {
            return SevenZip.CoderPropID.PosStateBits;
        }

        static StackObject* CopyToStack_PosStateBits_5(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = SevenZip.CoderPropID.PosStateBits;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static object get_LitContextBits_6(ref object o)
        {
            return SevenZip.CoderPropID.LitContextBits;
        }

        static StackObject* CopyToStack_LitContextBits_6(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = SevenZip.CoderPropID.LitContextBits;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static object get_LitPosBits_7(ref object o)
        {
            return SevenZip.CoderPropID.LitPosBits;
        }

        static StackObject* CopyToStack_LitPosBits_7(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = SevenZip.CoderPropID.LitPosBits;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static object get_NumFastBytes_8(ref object o)
        {
            return SevenZip.CoderPropID.NumFastBytes;
        }

        static StackObject* CopyToStack_NumFastBytes_8(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = SevenZip.CoderPropID.NumFastBytes;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static object get_MatchFinder_9(ref object o)
        {
            return SevenZip.CoderPropID.MatchFinder;
        }

        static StackObject* CopyToStack_MatchFinder_9(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = SevenZip.CoderPropID.MatchFinder;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static object get_MatchFinderCycles_10(ref object o)
        {
            return SevenZip.CoderPropID.MatchFinderCycles;
        }

        static StackObject* CopyToStack_MatchFinderCycles_10(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = SevenZip.CoderPropID.MatchFinderCycles;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static object get_NumPasses_11(ref object o)
        {
            return SevenZip.CoderPropID.NumPasses;
        }

        static StackObject* CopyToStack_NumPasses_11(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = SevenZip.CoderPropID.NumPasses;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static object get_Algorithm_12(ref object o)
        {
            return SevenZip.CoderPropID.Algorithm;
        }

        static StackObject* CopyToStack_Algorithm_12(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = SevenZip.CoderPropID.Algorithm;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static object get_NumThreads_13(ref object o)
        {
            return SevenZip.CoderPropID.NumThreads;
        }

        static StackObject* CopyToStack_NumThreads_13(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = SevenZip.CoderPropID.NumThreads;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static object get_EndMarker_14(ref object o)
        {
            return SevenZip.CoderPropID.EndMarker;
        }

        static StackObject* CopyToStack_EndMarker_14(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = SevenZip.CoderPropID.EndMarker;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }


        static object PerformMemberwiseClone(ref object o)
        {
            var ins = new SevenZip.CoderPropID();
            ins = (SevenZip.CoderPropID)o;
            return ins;
        }


    }
}
